package com.controller;


import com.baomidou.mybatisplus.extension.api.R;
import com.dao.DoctorDao;
import com.domain.Code;
import com.domain.Doctor;
import com.domain.Result;
import com.domain.User;
import com.service.IDoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.lang.reflect.Array;
import java.util.List;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private DoctorDao doctorDao;

    @PostMapping
    public Result login(@RequestBody User user){
        System.out.println(user);
      Integer count=doctorDao.login(user.getUsername(), user.getPassword());
        System.out.println(count);
        if(count!=null){
            return new Result("登录成功", Code.OK);
        }else{
            return new Result("输入了错误的用户名和密码",Code.ERR);
        }
    }

/*

    @PostMapping("/login/reg")
    public Result reg(String username,String password){

    }
*/

}
